{extend name="public/base" /}

{block name="title"}修改角色{/block}

{block name="main"}
<div class="layui-tab" id="Js_title_navigation">
    <ul class="layui-tab-title">
        <li class="layui-this">修改角色</li>
    </ul>
</div>
<form class="layui-form layui-row " action="" method="post">
    <input type="hidden" value="{$id}" name="id" />
	<div class="layui-col-xs12" style="padding-bottom: 50px;">
        <div class="layui-form-item layui-col-md4">
            <label class="layui-form-label">设置平台：</label>
            <div class="layui-input-inline"  >
              <select name="plat" {$checkpower ? 'disabled' :''}>
                <option {$info['plat'] == 2 ? 'selected=""':''} value="2">管理后台</option>
                <option {$info['plat'] == 3 ? 'selected=""':''} value="3">商户后台</option>
              </select>
            </div>
        </div>
		<div class="layui-form-item layui-col-md4">
			<label class="layui-form-label">角色名称：</label>
			<div class="layui-input-block">
				<input type="text" name="role" value="{$info['role']}" placeholder="请填写角色名称" lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item layui-col-md4">
			<label class="layui-form-label">角色描述：</label>
			<div class="layui-input-block">
				<input type="text" name="remark" value="{$info['remark']}" placeholder="请填写角色描述" lay-verify="required" class="layui-input">
			</div>
		</div>         
	</div>
    <div class="layui-layout-admin" >
        <div class="layui-footer" style="left:0;">
            <div class="layui-form-item">
                <a href="/sys/role/" class="layui-btn layui-btn-primary">取消</a>
				<button type="button" class="layui-btn" lay-submit="" lay-filter="addFrom">立即修改</button>
			</div>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script>
layui.use(['form'],function(){
    var form = layui.form;    
    
    form.on('submit(addFrom)',function(data){
        layer.load(3);
        $.post("/sys/role/edit",data.field,function(data){
            layer.closeAll();
            if(data.code==1){
                layer.msg(data.msg,{icon:6});
                $.jump2(data.url);
            }else{
                layer.msg(data.msg,{icon:5});
            }
        },"json");
        return false;
    });
    
    form.render(); //更新全部
})
</script>
{/block}